package com.apps.puzzle;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;


public class ImageAdapter extends BaseAdapter {
	
    private int miGaleriaImagenFondoItem;
	private Context contexto;
	private int numImagenes;
	private ArrayList<Integer> imagenes;
 
	
	public ImageAdapter(Context c,ArrayList<Integer> lista) {
		this.contexto = c;
		imagenes = new ArrayList<Integer>();
		imagenes=lista;
	}
	
	public ImageAdapter(Context c) {
		this.contexto = c;

	}
 
	public int getCount() {
		return imagenes.size();
	}
	
 

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}
	
	public View getView(int posicion, View convertView,ViewGroup parent) {

		ImageView iv = new ImageView(this.contexto);
		iv.setImageResource(this.imagenes.get(posicion));
		iv.setScaleType(ImageView.ScaleType.FIT_CENTER);
		iv.setLayoutParams(new Gallery.LayoutParams(100, 100));
		return iv;
	}

	public Context getContexto() {
		return contexto;
	}
	

	

}